"""
==和is的区别
"""


def use_is():
    x = [1, 2]
    y = [1, 2]
    print(id(x) == id(y))
    print(x is y)
    print(x == y)
    # 输出结果：
    """
    False
    False
    True
    """

    # Python中所有小于256个字节的对象都使用pymalloc实现的分配器，而大的对象则使用系统的malloc。
    a = 1
    b = 1
    print(id(a) == id(b))
    print(a is b)
    print(a == b)
    # 输出结果：
    """
    True
    True
    True
    """

    content_a = "aaaaaxaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    content_b = "aaaaaxaaaaaadaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    print(content_a is content_b)
    print(len(bytes(content_a, encoding="utf-8")))
    # 输出结果：
    """
    True
    True
    True
    """


if __name__ == '__main__':
    use_is()
